package com.app.biz.controller;

import com.app.biz.domain.BizIndustryPriceNewsDaily;
import com.app.biz.domain.formal.AppVersion;
import com.app.biz.service.IAppVersionService;
import com.app.biz.service.IBizIndustryPriceNewsDailyService;
import com.app.common.annotation.Anonymous;
import com.app.common.annotation.Log;
import com.app.common.core.controller.BaseController;
import com.app.common.core.domain.AjaxResult;
import com.app.common.core.page.TableDataInfo;
import com.app.common.enums.BusinessType;
import com.app.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;



@RestController
@RequestMapping("/biz/price/news")
public class BizIndustryPriceNewsDailyController extends BaseController
{
    @Autowired
    private IBizIndustryPriceNewsDailyService industryPriceNewsDailyService;




    @GetMapping("/list")
    public TableDataInfo list(BizIndustryPriceNewsDaily bizIndustryPriceNewsDaily)
    {
        startPage();
        List<BizIndustryPriceNewsDaily> list = industryPriceNewsDailyService.selectBizIndustryPriceNewsDailyList(bizIndustryPriceNewsDaily);
        return getDataTable(list);
    }





    @GetMapping(value = "/{baseId}")
    public AjaxResult getInfo(@PathVariable("baseId") String baseId)
    {
        return success(industryPriceNewsDailyService.selectBizIndustryPriceNewsDailyByBaseId(baseId));
    }



    @Log(title = "重点工业品价格每日新闻", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BizIndustryPriceNewsDaily bizIndustryPriceNewsDaily)
    {
        return toAjax(industryPriceNewsDailyService.insertBizIndustryPriceNewsDaily(bizIndustryPriceNewsDaily));
    }


    @Log(title = "重点工业品价格每日新闻", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BizIndustryPriceNewsDaily bizIndustryPriceNewsDaily)
    {
        return toAjax(industryPriceNewsDailyService.updateBizIndustryPriceNewsDaily(bizIndustryPriceNewsDaily));
    }


    @Log(title = "重点工业品价格每日新闻", businessType = BusinessType.DELETE)
    @DeleteMapping("/{baseIds}")
    public AjaxResult remove(@PathVariable String[] baseIds)
    {
        return toAjax(industryPriceNewsDailyService.deleteBizIndustryPriceNewsDailyByBaseIds(baseIds));
    }

    @GetMapping("/dailyNews")
    public AjaxResult dailyNews()
    {
        BizIndustryPriceNewsDaily bizIndustryPriceNewsDaily = industryPriceNewsDailyService.getBizIndustryPriceNewsDaily();
        return success(bizIndustryPriceNewsDaily);
    }
}
